package top.infopub.mgr.sts.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Maps;

import top.infopub.generic.GenericDao;
import top.infopub.generic.GenericServiceImpl;
import top.infopub.mgr.sts.dao.PackCollectDao;
import top.infopub.model.sts.PackCollect;
import top.infopub.mgr.sts.service.PackCollectService;

@Service
public class PackCollectServiceImpl extends GenericServiceImpl<PackCollect, String> implements
		PackCollectService {

	@Autowired
	private PackCollectDao packCollectDao;
	
	@Override
	public GenericDao<PackCollect, String> getDao() {
		return packCollectDao;
	}

    @Override
    public Page<PackCollect> selectDataByWhere(String type, String orgId, String orgProName,
                                               Page<PackCollect> page) {
        PageHelper.startPage(page.getPageNum(), page.getPageSize());
        Map<String, Object> where = Maps.newHashMap();
        if(type.equals("2")){//区域公司
            where.put("hrOrgAreaId", orgId);
        }else if(type.equals("3")){//项目公司
            where.put("hrOrgProId", orgId);
        }
        where.put("proName", orgProName);
        return (Page<PackCollect>)packCollectDao.selectDataByWhere(where);
    }

}